var oDepartment=document.querySelector('.departmentSelection');
var oa=document.querySelector('#firstBox');
var ob=document.querySelector('.maskLayerRight');
var oc=document.querySelector('.daisyOne');
var od=document.querySelector('.daisyTwo');
var departmentArray=[];
var str;
(function(){
    oDepartment.onclick=function(){
      oa.className='firstBox';
      ob.className='maskLayerBrown';
      var oFirstBox=document.querySelector('#firstBox');
      oFirstBox.style.display='block';
    }
})();

(function(){
  oc.onclick=function(){
  var a=document.createElement('span');
  od.appendChild(a);
  a.innerHTML='&gt 黛西进出口贸易公司浙江分公司';
  a.style.margin='0 5px';
  a.style.color='#e4e4e4';
  
  }
})();
(function(){
  var oRadio=document.querySelectorAll('.radioButton');
  var a=[true,true,true];
  for(var i=0;i<oRadio.length;i++){
    oRadio[i].dataset.indexNumber=i;
    oRadio[i].onclick=function(){
      if(a[this.dataset.indexNumber]){
        // console.log('sd'+a[this.dataset.indexNumber]);
        this.setAttribute('src','../images/1_u1618_selected.png');
        this.dataset.indexValue='true';
        a[this.dataset.indexNumber]=false;
        
        
      }else{
        // console.log('sb'+a[this.dataset.indexNumber]);
        this.setAttribute('src','../images/u375.png');
        this.dataset.indexValue='false';
        a[this.dataset.indexNumber]=true;
        
      }
    }
  }
 
})();
function sd(){
  var a=document.querySelector('.confirmOne');
  var b=document.querySelector('.whiteselectionbox');
  var c=document.querySelectorAll('.radioButton');
  var e=document.querySelectorAll('.deleteA');
  
  var d=['产品部','研发部','营销部'];
  // 
 
    a.onclick=function(){
      for(var i=0;i<c.length;i++){
        if(c[i].dataset.indexValue){
          var oDiv=document.createElement('div');
          b.appendChild(oDiv);
          oDiv.style.width='92px';
          oDiv.style.height='32px';
          oDiv.style.textAlign='center';
          oDiv.style.lineHeight='32px';
          oDiv.style.background='blue';
          oDiv.style.color='rgb(255,255,255)';
          oDiv.style.display='inline-block';
          oDiv.style.marginRight='7px';
          oDiv.className='ghjk';
          
          oDiv.innerHTML='<span>'+d[i]+'</span>'+'&nbsp;&nbsp;|&nbsp;&nbsp;'+'<span class="deleteA">X</span>';
          departmentArray[i]=d[i];
          console.log( departmentArray[i]);
            
          }
      }
      var oFirstBox=document.querySelector('#firstBox');
      oFirstBox.style.display='none'; 
      var asx=document.querySelector('.departmentSelectionValue');
      for(var i=0;i<departmentArray.length;i++){
        str+=departmentArray[i];
        console.log(str);
      }
      asx.value=str.substring(9);
      
      
      };
      

};
setTimeout(sd,400);
(function(){
  var a=document.querySelector('.handleResignationOne');
  var b=document.querySelector('.initiateResignation');
  var c=document.querySelector('.handleResignation');
 c.onclick=function(){
   if(b.style.display=='none'){
    b.style.display='block';
   }else{
    b.style.display='none';
   }
  } 
})();
(function(){
 var a= document.querySelector('.exitImport');
 var b=document.querySelector('.imporTmask');
 a.onclick=function(){
  b.style.display='none';
 }
})();
(function(){
  var a=document.querySelector('.export');
  a.onclick=function(){
    alert('导出成功');
  }
})();

/* (function(){
 var a= document.querySelectorAll('.pictureDistribution');
 var b= document.querySelectorAll('.confirmResignation');
 var c= document.querySelectorAll('.sdfghcvx');
 var d= document.querySelector('.ewfrgegeth');
 
 for(var i=0;i<a.length;i++){
  b[i].dataset.index=i;
  b[i].onclick=function(){
    if(a[this.dataset.index].getAttribute('src')=='../images/u190.png'){
     d.removeChild(c[this.dataset.index]);
    };
   }
 };
})(); */
(function(){
 var a= document.querySelectorAll('.pictureDistribution');
 for(var i=0;i<a.length;i++){
  a[i].onclick=function(){
    if(this.getAttribute('src')=='../images/u189.png'){
      this.setAttribute('src','../images/u190.png')
    }else{
      this.setAttribute('src','../images/u189.png')
    }
   }
 }
})();
var pictureNumber=0;
(function(){
  var a= document.querySelectorAll('.pictureDistribution');
  var b=document.querySelector('.selectAllEmployees');
  /* for(var i=1;i<a.length;i++){
   a[i].onclick=function(){
     if(this.getAttribute('src')=='../images/u190.png'){
       i++;
     }else{
      i--;
     }
    }
  } */
  b.onclick=function(){
   
    if(this.getAttribute('src')=='../images/u189.png'){
      for(var i=0;i<a.length;i++){
        if(a[i].getAttribute('src')=='../images/u190.png'){
          a[i].setAttribute('src','../images/u189.png')
       }
      };
      this.setAttribute('src','../images/u190.png')
      }else{
        this.setAttribute('src','../images/u189.png')
      };
    for(var i=0;i<a.length;i++){
        if(a[i].getAttribute('src')=='../images/u189.png'){
          a[i].setAttribute('src','../images/u190.png')
       }else{
        a[i].setAttribute('src','../images/u189.png')
       }
     }
  }
 })();

 /* (function(){
  var a=document.querySelector('.boxFunctionSet');
  var b=document.querySelector('.boxDisplay');
  
  b.onclick=function(){
    if(a.style.display=='none'){
      a.style.display='block';
    }else{
      a.style.display='none';
    }
  }
})(); */
(function(){
  var a=document.querySelector('.resignationFormFifth');
  var b=document.querySelector('.ewfrgegeth');
  
  a.onclick=function(){
    var c=document.createElement('div');
    c.innerHTML=' <div class="resignationForm secondBackgroundColor sdfghcvx"><div class="resignationFormFirst"><img src="../images/u189.png" alt="" class="pictureDistribution"></div><div class="headPortrait chaoWenyi"><img src="../images/u3676.png" alt=""><div>晁文漪</div></div><div class="employeeNo">GH000001</div><div class="department">黛西进出口贸易公司 / 研发部</div><div  class="resignationFormSecond position" >产品经理</div><div  class="resignationFormSecond resignationType">19220880099</div><div class="resignationType">主动离职</div><div class="applicationDate">2022-01-01</div><div class="applicationDate">2022-01-02</div><div class="applicationDate">2022-01-02</div><div class="applicationDate">2022-01-02</div><div class="applicationDate">个人原因</div><div class="reasonForResignation">居住城市迁移</div><div class="resignationApproval">未发起</div><div class="resignationFormFourth operation"><div class="confirmResignation">确认离职</div><div>放弃离职</div></div></div>'
    b.appendChild(c);
  }
})()